<!DOCTYPE html>
<html>
<head>
	<title> 过滤器 Filter</title>
	<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
<div id="app">
	<!-- 首字母转换成大写 -->
	<h1> {{message|capitalize}}</h1>
	<h1> {{message|capitalize|filterB}}</h1>
</div>

</body>
</html>
<script type="text/javascript">
	var app=new Vue({
		el:"#app",
		data:{
			message:"hello"
		},
		filters:{
			//首字母大写,过滤器方法
			capitalize: function (value) {
				if (!value) return ''
				value = value.toString()
				return value.charAt(0).toUpperCase() + value.slice(1)
			},

			filterB:function(value){
				console.log(value);
				value = value.toString()+" World"
				return value;
			}
		},
		methods:{

		}
	});
</script>